<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
</head>
<body>
    <div id="root">
        <input type="text" name="" id="" v-model="keyWord">
       <ul>
           <li v-for="(p,index) of persons" :key="p.id">
               {{p.name}}
           </li>
       </ul>
    </div>
    <script>
        const x =new Vue({
            el:'#root',

            data:{
                keyWord:"",
                persons:[
                    {id:'1',name:"zhangsan"},
                    {id:'2',name:"lisi"},
                ]
            },
            methods: {
            
            },
            watch:{
                keyWord(newVal,oldVal){
                    console.log("keyword被修改了oldVal:"+oldVal+"newVal"+newVal);
                }
            }
        })
    </script>
</body>
</html>